home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / automake.0 / automake / automake-1.0 / depend.am < prev    next >
Encoding:
Text File  |  1996-02-21  |  2.5 KB  |  60 lines

  1. ## automake - create Makefile.in from Makefile.am
  2. ## Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
  3.  
  4. ## This program is free software; you can redistribute it and/or modify
  5. ## it under the terms of the GNU General Public License as published by
  6. ## the Free Software Foundation; either version 2, or (at your option)
  7. ## any later version.
  8.  
  9. ## This program is distributed in the hope that it will be useful,
  10. ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. ## GNU General Public License for more details.
  13.  
  14. ## You should have received a copy of the GNU General Public License
  15. ## along with this program; if not, write to the Free Software
  16. ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  17. ## 02111-1307, USA.
  18. # This fragment is probably only useful for maintainers.  It relies on
  19. # GNU make and gcc.  It is only included in the generated Makefile.in
  20. # if `automake' is not passed the `--include-deps' flag.
  21.  
  22. MKDEP = gcc -MM $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
  23.  
  24. ## We use ".P" as the name of our placeholder because it can't be
  25. ## duplicated by any C source file.  (Well, there could be ".c", but
  26. ## no one does that in practice)
  27. -include $(srcdir)/.deps/.P
  28. $(srcdir)/.deps/.P: $(BUILT_SOURCES)
  29.     cd $(srcdir) && test -d .deps || mkdir .deps
  30. ## Use ":" here and not "echo timestamp".  Otherwise GNU Make barfs:
  31. ## .deps/.P:1: *** missing separator.  Stop.
  32. ## Actually, use a plain "echo" and not ":".  Why?  From the Autoconf
  33. ## manual, node Automatic Remaking:
  34. ## On some old BSD systems, `touch' or any command that results in an
  35. ## empty file does not update the timestamps, so use a command like
  36. ## `echo' as a workaround.
  37.     echo > $@
  38.  
  39. -include $(DEP_FILES)
  40. $(DEP_FILES): $(srcdir)/.deps/.P
  41.  
  42. $(srcdir)/.deps/%.P: $(srcdir)/%.c
  43.     @echo "mkdeps $< > $@"
  44. ## Use funny regexp because otherwise too much can be matched when
  45. ## srcdir begins with ".".  Can't use \< since sed doesn't recognize
  46. ## "." as a word start.  Regexp-quote srcdir because "." is a matching
  47. ## operator which commonly appears in filenames.  Need "//*" in
  48. ## regexps because otherwise the regexp will fail when srcdir=. and
  49. ## the path to the file is relative (eg ../lib/error.c matches "./*").
  50.     @re=`echo 's,^$(srcdir)//*,,g;s, $(srcdir)//*, ,g' | sed 's,\.,\\\\.,g'`; \
  51.       $(MKDEP) $< | sed "$$re" > $@-tmp
  52.     @if test -n "$o"; then            \
  53.       sed 's/\.o:/$$o:/' $@-tmp > $@;    \
  54.       rm $@-tmp;                \
  55.     else                    \
  56.       mv $@-tmp $@;                \
  57.     fi
  58.  
  59. # End of maintainer-only section
  60.